package com.woniuxy.propertyjava.service.impl;

import com.woniuxy.propertyjava.entity.Holdinformation;
import com.woniuxy.propertyjava.entity.PageBean;
import com.woniuxy.propertyjava.entity.Propertyconteanct;
import com.woniuxy.propertyjava.dao.PropertyconteanctDao;
import com.woniuxy.propertyjava.service.PropertyconteanctService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * (Propertyconteanct)表服务实现类
 *
 * @author makejava
 * @since 2022-07-08 14:57:51
 */
@Service("propertyconteanctService")
public class PropertyconteanctServiceImpl implements PropertyconteanctService {
    @Resource
    private PropertyconteanctDao propertyconteanctDao;

    /**
     * 通过ID查询单条数据
     *
     * @param pcid 主键
     * @return 实例对象
     */
    @Override
    public Propertyconteanct queryById(Integer pcid) {
        return this.propertyconteanctDao.queryById(pcid);
    }

    /**
     * 分页查询
     *
     * @param propertyconteanct 筛选条件
     * @ pageRequest      分页对象
     * @return 查询结果
     */
    @Override
    public PageBean<Propertyconteanct> queryByPage(Propertyconteanct propertyconteanct, int pageIndex,int pageSize) {
        PageBean<Propertyconteanct> pageBean=new PageBean<>();
        pageBean.setBeanList(propertyconteanctDao.queryAllByLimit( pageIndex,pageSize,propertyconteanct));
        pageBean.setPageIndex(pageIndex);
        pageBean.setPageSize(pageSize);
        pageBean.setTotalRecode(propertyconteanctDao.count(propertyconteanct));
        return pageBean;
    }

    /**
     * 新增数据
     *
     * @param propertyconteanct 实例对象
     * @return 实例对象
     */
    @Override
    public Propertyconteanct insert(Propertyconteanct propertyconteanct) {
        this.propertyconteanctDao.insert(propertyconteanct);
        return propertyconteanct;
    }

    /**
     * 修改数据
     *
     * @param propertyconteanct 实例对象
     * @return 实例对象
     */
    @Override
    public Propertyconteanct update(Propertyconteanct propertyconteanct) {
        this.propertyconteanctDao.update(propertyconteanct);
        return this.queryById(propertyconteanct.getPcid());
    }

    /**
     * 通过主键删除数据
     *
     * @param pcid 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer pcid) {
        return this.propertyconteanctDao.deleteById(pcid) > 0;
    }
}
